Method for scanning cache of application and electronic device

ABSTRACT

Disclosed are a method for scanning cache of an application, an electronic device and a computer-readable storage medium. The method may include: acquiring a list of applications to be scanned; querying a historical scanning record of each application in the list of applications to be scanned; determining a scanning priority of each application and whether the application needs to be scanned according to the historical scanning record of each application; scanning applications that need to be scanned in the list of applications to be scanned in a descending order of the scanning priorities, so as to acquire cache sizes of respective applications that need to be scanned; and scanning applications that need not to be scanned in the list of applications to be scanned in a descending order of the scanning priorities, so as to acquire cache sizes of respective applications that need not to be scanned.

CROSS REFERENCE TO RELATED APPLICATION

This application is a continuation of International Application No.PCT/CN2017/087632, filed on Jun. 8, 2017, which claims priority to andbenefits of Chinese Patent Application No. 201610474631.6, filed withState Intellectual Property Office on Jun. 24, 2016 by BEIJING KINGSOFTINTERNET SECURITY SOFTWARE CO., LTD., which is entitled as “cachescanning method and apparatus for application program, and electronicdevice”, the entire content of both of which are incorporated herein byreference.

FIELD

The present disclosure relates to cache cleaning technology field, andmore particularly to a method and an apparatus for scanning cache of anapplication.

BACKGROUND

Usually, after a user installs an application on a mobile phone, thereis a cache of the application on the mobile phone, which occupies thestorage space of the mobile phone. In order to save storage space on thephone, the user usually performs a cache cleaning. When cleaning up theapplication's cache on the mobile phone, a scanning should be performedfirstly to acquire a total cache size of the application, and then thecache is to be cleaned up after the scanning.

Currently, the mobile phone may acquire the total cache size of theapplication in following manners.

According to a list of applications installed on the Android mobilephone, a getPackageSizeInfo function is invoked for each application toobtain the cache size of each application, and the cache sizes of allapplications are added up to obtain the total cache size.

As the phone will process a request internally when thegetPackageSizeInfo function is invoked, the scanning time will beextremely long when there are several applications installed on theuser's mobile phone.

SUMMARY

To this end, embodiments of the present disclosure provide a method forscanning cache of an application and an electronic device.

In order to solve the above objective, embodiments of the presentdisclosure apply the following technical solutions.

Embodiments of the present disclosure provide a method for scanningcache of an application. The method may include: acquiring a list ofapplications to be scanned; querying a historical scanning record ofeach application in the list of applications to be scanned; determininga scanning priority of each application and whether the applicationneeds to be scanned according to the historical scanning record of eachapplication; scanning applications that need to be scanned in the listof applications to be scanned in a descending order of the scanningpriorities, so as to acquire cache sizes of respective applications thatneed to be scanned; and scanning applications that need not to bescanned in the list of applications to be scanned in a descending orderof the scanning priorities, so as to acquire cache sizes of respectiveapplications that need not to be scanned, and finishing the scanninguntil a preset scanning duration is reached or a preset scanning endingcondition is satisfied.

Embodiments of the present disclosure provide an electronic device. Theelectronic device may include: a housing, a processor, a memory, acircuit board, a power supply circuit, in which, the circuit board islocated in a space enclosed by the housing; the processor and the memoryare positioned on the circuit board; the power supply circuit isconfigured to provide power for respective circuits or components of theelectronic device; the memory is configured to store executable programcodes; and the processor is configured to run a program corresponding tothe executable program codes by reading the executable program codesstored in the memory, to perform any of the above-described methods forscanning cache of an application.

Embodiments of the present disclosure provide a storage medium, in whichwhen instructions in the storage medium are executed by a processor, theprocessor is caused to perform the method for scanning cache of anapplication, including: acquiring a list of applications to be scanned;querying a historical scanning record of each application in the list ofapplications to be scanned; determining a scanning priority of eachapplication and whether the application needs to be scanned according tothe historical scanning record of each application; scanningapplications that need to be scanned in the list of applications to bescanned in a descending order of the scanning priorities, so as toacquire cache sizes of respective applications that need to be scanned;and scanning applications that need not to be scanned in the list ofapplications to be scanned in a descending order of the scanningpriorities, so as to acquire cache sizes of respective applications thatneed not to be scanned, and finishing the scanning until a presetscanning duration is reached or a preset scanning ending condition issatisfied.

BRIEF DESCRIPTION OF THE DRAWINGS

In order to make technique solutions according to embodiments of thepresent disclosure more apparent, drawings needed to be used indescriptions of the embodiments will be illustrated in the following.Obviously, the drawings to be illustrated in the following onlyrepresent some embodiments of the present disclosure, and other drawingscan be obtained according these drawings by those having ordinary skillsin the related art without making creative labors.

FIG. 1 is a flow chart of a method for scanning cache of an applicationaccording to an embodiment of the present disclosure;

FIG. 2 is a flow chart of a method for scanning cache of an applicationaccording to an embodiment of the present disclosure;

FIG. 3 is a structure diagram of an apparatus for scanning cache of anapplication according to an embodiment of the present disclosure;

FIG. 4 is a structure diagram of an apparatus for scanning cache of anapplication according to an embodiment of the present disclosure; and

FIG. 5 is a structure diagram of an electronic device according to anembodiment of the present disclosure.

DETAILED DESCRIPTION

Embodiments of the present disclosure are hereinafter described withreference to accompanying drawings.

It should be noted that, the described embodiments are a part ofembodiments of the present disclosure, but not all embodiments. Allother embodiments obtained by those skilled in the art based on theembodiments in the present disclosure without creative labor shall fallin the protection scope of the present disclosure.

FIG. 1 is a flow chart of a method for scanning cache of an applicationaccording to an embodiment of the present disclosure. As shown in FIG.1, the method in this embodiment may include followings.

At block 11, a list of applications to be scanned is acquired.

In this embodiment, a list of applications installed on the electronicdevice may be acquired by invoking a system interface, and a packagename of each application may be included in the list of applications.

At block 12, a historical scanning record of each application in thelist of applications to be scanned is queried.

In this embodiment, a database is created on the electronic device tostore the package name and the corresponding historical scanning record.The package name stored in the database corresponds to the package namein the list of the applications. According to the package name of eachapplication, the historical scanning record corresponding to the packagename may be queried in the database, so that the historical scanningrecord of each application may be obtained.

The historical scanning record may include a cache size and a time for aprevious scanning and a number of successively skipped times.

For a certain application, the number of successively skipped times maybe reset to zero after the scanning, and the number of successivelyskipped times adds one when the scanning is skipped.

At block 13, a scanning priority of each application and whether theapplication needs to be scanned are determined according to thehistorical scanning record of each application.

In this embodiment, the scanning priority of each application andwhether the application needs to be scanned are determined in followingmanners.

It is determined that the application without the historical scanningrecord is to be preferentially scanned and needs to be scanned.

A first set of applications each with the cache size for the previousscanning greater than a preset cache size are compared, in which theapplication with a large cache size for the previous scanning in thefirst set of applications is preferentially scanned and needs to bescanned, and the scanning priorities of applications with the same cachesize for the previous scanning in the first set of applications are thesame. The preset cache size may be the maximum cache size for theprevious scanning which can be skipped. In other words, a first set ofapplications each with the cache size for the previous scanning greaterthan a preset cache size are acquired, in which the applications eachwith the cache size for the previous scanning greater than the presetcache size need to be scanned and are to be scanned in a descendingorder of the cache sizes. The preset cache size may be set to 32 kb, forexample.

A second set of applications each with the number of successivelyskipped times greater than a preset number are compared, in which theapplication with a great number of successively skipped times in thesecond set of applications is preferentially scanned and needs to bescanned, and the scanning priorities of applications with the samenumber of successively skipped times in the second set of applicationsare the same. In other words, a second set of applications each with thenumber of successively skipped times greater than a preset number areacquired, in which the applications each with the number of successivelyskipped times greater than the preset number need to be scanned and areto be scanned in a descending order of the numbers of successivelyskipped times. The preset number is a maximum number of successivelyskipped times, which has a default value of 3.

A third set of applications each with a time difference between apresent time and the time for the previous scanning greater than apreset time interval are compared, in which the application with a greattime difference in third set of applications is preferentially scannedand needs to be scanned, and the scanning priorities of applicationswith the same time difference in the third set of applications are thesame. The preset time interval is a maximum time interval for which thescanning can be skipped. In other words, a third set of applicationseach with a time difference between a present time and the time for theprevious scanning greater than a preset time interval are acquired, inwhich the applications each with the time difference greater than thepreset time interval need to be scanned and are to be scanned in adescending order of the time differences. The preset time interval maybe set to 7 days.

A fourth set of applications each with the cache size for the previousscanning smaller than or equal to the preset cache size are compared, inwhich the application with a large cache size for the previous scanningin the fourth set of applications is preferentially scanned and needsnot to be scanned, and the scanning priorities of applications with thesame cache size for the previous scanning in the fourth set ofapplications are the same. In other words, a fourth set of applicationseach with the cache size for the previous scanning smaller than or equalto the preset cache size are acquired, in which the applications eachwith the cache size for the previous scanning smaller than or equal tothe preset cache size need not to be scanned and are to be scanned in adescending order of the cache sizes if the applications in the fourthset of applications are to be scanned.

A fifth set of applications each with the number of successively skippedtimes smaller than or equal to the preset number are compared, in whichthe application with a great number of successively skipped times in thefifth set of applications is preferentially scanned and needs not to bescanned, and the scanning priorities of applications with the samenumber of successively skipped times in the fifth set of applicationsare the same. In other words, a fifth set of applications each with thenumber of successively skipped times smaller than or equal to the presetnumber are acquired, in which the applications each with the number ofsuccessively skipped times smaller than or equal to the preset numberneed not to be scanned and are to be scanned in a descending order ofthe numbers of successively skipped times if the applications in thefifth set of applications are to be scanned.

It is determined that the scanning priorities of a sixth set ofapplications in the list of applications to be scanned and beyond thefirst to fifth sets of applications are the same and the sixth set ofapplications need not to be scanned.

At block 14, applications that need to be scanned in the list ofapplications to be scanned are scanned in a descending order of thescanning priorities to acquire cache sizes of respective applicationsthat need to be scanned.

In this embodiment, for electronic devices installed with Androidsystem, when scanning the applications, the cache size of theapplication may be acquired by invoking the getPackageSizeInfo function.

At block 15, applications that need not to be scanned in the list ofapplications to be scanned are scanned in a descending order of thescanning priorities to acquire cache sizes of respective applicationsthat need not to be scanned, and the scanning ends until a presetscanning duration is reached or a preset scanning ending condition issatisfied.

In this embodiment, when scanning the application that needs not to bescanned in the list of the applications, it is determined whether thepreset scanning duration is reached, if yes, the scanning ends;otherwise, it is determined whether the preset scanning ending conditionis met, and if yes, the scanning ends; otherwise, the cache size of theapplication that needs not to be scanned is obtained.

The preset scanning duration may be set to 10 seconds.

In this embodiment, a scanning priority of each application and whetherthe application needs to be scanned may be determined according to ahistorical scanning record of each application in a list of applicationsto be scanned. Applications that need to be scanned in the list ofapplications to be scanned are scanned in a descending order of thescanning priorities to acquire cache sizes of respective applicationsthat need to be scanned. Applications that need not to be scanned in thelist of applications to be scanned are scanned in a descending order ofthe scanning priorities to acquire cache sizes of respectiveapplications that need not to be scanned. The scanning ends until apreset scanning duration is reached or a preset scanning endingcondition is satisfied. Compared to the prior art, according to thepresent disclosure, after the application that needs to be scanned arescanned, the application that need not to be scanned may be stopped tobe scanned and the scanning may be stopped according to the practicalsituation in any time, such that the time duration of scanning may beshortened without affecting the scanning results.

FIG. 2 is a flow chart of a method for scanning cache of an applicationaccording to an embodiment of the present disclosure. As shown in FIG.2, the method in this embodiment may include followings.

At block 21, a list of applications to be scanned is acquired.

In this embodiment, the process of acquiring the list of applications tobe scanned is similar to the act in block 11, which will not bedescribed in detail herein.

At block 22, a historical scanning record of each application in thelist of applications to be scanned is queried.

In this embodiment, the process of querying the historical scanningrecord of each application in the list of applications to be scanned issimilar to the act in block 12, which will not be described in detailherein.

At block 23, a scanning priority of each application and whether theapplication needs to be scanned are determined according to thehistorical scanning record of each application.

In this embodiment, the process of determining the scanning priority ofeach application and whether the application needs to be scannedaccording to the historical scanning record of each application issimilar to the act in block 13, which will not be described in detailherein.

At block 24, the list of applications to be scanned are sorted in adescending order of the scanning priorities.

In this embodiment, in order to scan applications with same priorities,the application which is sorted ahead in the original order is sorted inthe front of the scanning row.

At block 25, applications that need to be scanned in the list ofapplications to be scanned are scanned in a descending order of thescanning priorities to acquire cache sizes of respective applicationsthat need to be scanned.

In this embodiment, the process of scanning applications that need to bescanned in the list of applications to be scanned in a descending orderof the scanning priorities to acquire cache sizes of respectiveapplications that need to be scanned is similar to the act in block 14,which will not be described in detail herein.

At block 26, applications that need not to be scanned in the list ofapplications to be scanned are scanned in a descending order of thescanning priorities to acquire cache sizes of respective applicationsthat need not to be scanned, and the scanning ends until a presetscanning duration is reached or a preset scanning ending condition issatisfied.

In this embodiment, the process of scanning the applications that neednot to be scanned in the list of applications to be scanned in adescending order of the scanning priorities to acquire cache sizes ofrespective applications that need not to be scanned is similar to theact in block 15, which will not be described in detail herein.

At block 27, the cache size and the time for the previous scanning andthe number of successively skipped times of each application are updatedaccording to a scanning result after the scanning of respectiveapplication finishes.

In this embodiment, the cache size and the time for the previousscanning and the number of successively skipped times of the applicationstored in the database are updated according to the cache size and thetime for the previous scanning and the number of successively skippedtimes for the scanned application, for the next scanning.

In this embodiment, a scanning priority of each application and whetherthe application needs to be scanned may be determined according to ahistorical scanning record of each application in a list of applicationsto be scanned. Applications that need to be scanned in the list ofapplications to be scanned are scanned in a descending order of thescanning priorities to acquire cache sizes of respective applicationsthat need to be scanned. Applications that need not to be scanned in thelist of applications to be scanned are scanned in a descending order ofthe scanning priorities to acquire cache sizes of respectiveapplications that need not to be scanned. The scanning ends until apreset scanning duration is reached or a preset scanning endingcondition is satisfied. The cache size and the time for the previousscanning and the number of successively skipped times of eachapplication are updated according to a scanning result after thescanning of respective application finishes. Compared to the prior art,according to the present disclosure, after the application that needs tobe scanned are scanned, the application that need not to be scanned maybe stopped to be scanned and the scanning may be stopped according tothe practical situation in any time, such that the time duration ofscanning may be shortened without affecting the scanning results. Inaddition, the historical scanning record is updated after the scanningfinishes for the next scanning, such that the scanning accuracy may beensured.

FIG. 3 is a structure diagram of an apparatus for scanning cache of anapplication according to an embodiment of the present disclosure. Asshown in FIG. 3, the apparatus in this embodiment may include: anacquiring unit 11, a querying unit 12, a determining unit 13, a firstscanning unit 14 and a second scanning unit 15. The acquiring unit 11 isconfigured to acquire a list of applications to be scanned. The queryingunit 12 is configured to query a historical scanning record of eachapplication in the list of applications to be scanned. The determiningunit 13 is configured to determine a scanning priority of eachapplication and whether the application needs to be scanned according tothe historical scanning record of each application. The first scanningunit 14 is configured to scan applications that need to be scanned inthe list of applications to be scanned in a descending order of thescanning priorities, so as to acquire cache sizes of respectiveapplications that need to be scanned. The second scanning unit 15 isconfigured to scan applications that need not to be scanned in the listof applications to be scanned in a descending order of the scanningpriorities, so as to acquire cache sizes of respective applications thatneed not to be scanned, and to finish the scanning until a presetscanning duration is reached or a preset scanning ending condition issatisfied.

The apparatus in this embodiment is configured to perform the technicalsolution described in the method embodiment illustrated in FIG. 1. Theimplementing principles and technical effects for the apparatus and themethod are similar, which will not be described in detail herein.

In an embodiment, the historical scanning record may include a cachesize and a time for a previous scanning and a number of successivelyskipped times.

Further, the determining unit 13 is configured to determine that theapplication without the historical scanning record is to bepreferentially scanned and needs to be scanned; compare a first set ofapplications each with the cache size for the previous scanning greaterthan a preset cache size, in which the application with a large cachesize for the previous scanning in the first set of applications ispreferentially scanned and needs to be scanned, and the scanningpriorities of applications with the same cache size for the previousscanning in the first set of applications are the same; compare a secondset of applications each with the number of successively skipped timesgreater than a preset number, in which the application with a greatnumber of successively skipped times in the second set of applicationsis preferentially scanned and needs to be scanned, and the scanningpriorities of applications with the same number of successively skippedtimes in the second set of applications are the same; compare a thirdset of applications each with a time difference between a present timeand the time for the previous scanning greater than a preset timeinterval, in which the application with a great time difference in thirdset of applications is preferentially scanned and needs to be scanned,and the scanning priorities of applications with the same timedifference in the third set of applications are the same; compare afourth set of applications each with the cache size for the previousscanning smaller than or equal to the preset cache size, in which theapplication with a large cache size for the previous scanning in thefourth set of applications is preferentially scanned and needs not to bescanned, and the scanning priorities of applications with the same cachesize for the previous scanning in the fourth set of applications are thesame; compare a fifth set of applications each with the number ofsuccessively skipped times smaller than or equal to the preset number,in which the application with a great number of successively skippedtimes in the fifth set of applications is preferentially scanned andneeds not to be scanned, and the scanning priorities of applicationswith the same number of successively skipped times in the fifth set ofapplications are the same; and determine that the scanning priorities ofa sixth set of applications in the list of applications to be scannedand beyond the first to fifth sets of applications are the same and thesixth set of applications need not to be scanned.

FIG. 4 is a structure diagram of an apparatus for scanning cache of anapplication according to an embodiment of the present disclosure. Asshown in FIG. 4, based on the structure of the apparatus illustrated inFIG. 3, the apparatus in this embodiment may also include a sorting unit16, configured to sort the list of applications to be scanned in adescending order of the scanning priorities after the determining unit13 determines a scanning priority of each application and whether theapplication needs to be scanned according to the historical scanningrecord of each application.

Further, the apparatus may also include an updating unit 17, configuredto update the cache size and the time for the previous scanning and thenumber of successively skipped times of each application according to ascanning result after the scanning of respective application finishes.

In an embodiment, the querying unit 12 is configured to query thehistorical scanning record corresponding to a package name of eachapplication according to the package name of each application.

The apparatus may be configured to perform the technical solution of themethod embodiments illustrated in FIG. 1 and FIG. 2. The implementingprinciples and technical effects for the apparatus and the method aresimilar, which will not be described in detail herein.

In should be noted that, in this description, relation terms such asfirst and second and the like is merely used to distinguish an object oroperation from another object or operation, and it is not necessary torequire or imply that there is any real relations or order among theseobjects or operations. Furthermore, terms “comprise”, “include” or anyother modifications are aim at covering non-exclusive “include”, suchthat a process, a method, a term or a device including a series ofelements also includes other elements which are not listed definitely.Without further limitation, an element defined by a sentence “include a. . . ” may not exclusive of other same elements included in theprocess, the method, the term or the device including the said element.

The various embodiments in the present specification are described in arelated manner, and the same or similar parts between the variousembodiments may be referred to each other, and each embodiment focuseson the differences from the other embodiments.

In particular, since the apparatus embodiment is basically similar tothe method embodiment, the description is relatively simple, and therelevant parts can be referred to the description of the methodembodiment.

The logic and/or step described in other manners herein or shown in theflow chart, for example, a particular sequence table of executableinstructions for realizing the logical function, may be specificallyachieved in any computer readable medium to be used by the instructionexecution system, device or equipment (such as the system based oncomputers, the system comprising processors or other systems capable ofobtaining the instruction from the instruction execution system, deviceand equipment and executing the instruction), or to be used incombination with the instruction execution system, device and equipment.As to the specification, “the computer readable medium” may be anydevice adaptive for including, storing, communicating, propagating ortransferring programs to be used by or in combination with theinstruction execution system, device or equipment. More specificexamples of the computer readable medium comprise but are not limitedto: an electronic connection (an electronic device) with one or morewires, a portable computer enclosure (a magnetic device), a randomaccess memory (RAM), a read only memory (ROM), an erasable programmableread-only memory (EPROM or a flash memory), an optical fiber device anda portable compact disk read-only memory (CDROM). In addition, thecomputer readable medium may even be a paper or other appropriate mediumcapable of printing programs thereon, this is because, for example, thepaper or other appropriate medium may be optically scanned and thenedited, decrypted or processed with other appropriate methods whennecessary to obtain the programs in an electric manner, and then theprograms may be stored in the computer memories.

It should be understood that each part of the present disclosure may berealized by the hardware, software, firmware or their combination.

In the above embodiments, a plurality of steps or methods may berealized by the software or firmware stored in the memory and executedby the appropriate instruction execution system. For example, if it isrealized by the hardware, likewise in another embodiment, the steps ormethods may be realized by one or a combination of the followingtechniques known in the art: a discrete logic circuit having a logicgate circuit for realizing a logic function of a data signal, anapplication-specific integrated circuit having an appropriatecombination logic gate circuit, a programmable gate array (PGA), a fieldprogrammable gate array (FPGA), etc.

Embodiments of the present disclosure also provide an electronic device.The electronic device may include any of apparatuses in theabove-described embodiments.

FIG. 5 is a structure diagram of an electronic device according to anembodiment of the present disclosure. The electronic device may realizethe method flow of the embodiments illustrated in FIG. 1 or FIG. 2. Asshown in FIG. 5, the above-described electronic device may include ahousing 31, a processor 32, a memory 33, a circuit board 34 and a powersupply circuit 35, in which the circuit board 34 is located in a spaceenclosed by the housing 31, the processor 32 and the memory 33 arepositioned on the circuit board 34, the power supply circuit 35 isconfigured to provide power for respective circuits or components of theelectronic device, the memory 33 is configured to store executableprogram codes, and the processor 32 is configured to run a programcorresponding to the executable program codes by reading the executableprogram codes stored in the memory 33, to perform any of theabove-described methods for scanning cache of an application.

The specific implementation process of the above steps performed by theprocessor 32 or by the processor performing executable program codes mayrefer to the description of the embodiments illustrated in FIG. 1 orFIG. 2, which will not be described in detail herein.

The electronic device may exist in various forms, including but not belimited to the followings.

(1) Mobile communication equipment, which is characterized by its mobilecommunication function and is mainly aimed at providing voice and datacommunication. Such terminals include: smart phones (such as iPhone),multimedia phones, functional phones, and low-end phones.

(2) Ultra-mobile PC devices, which belong to the category of personalcomputers, have computing and processing functions, and generally havemobile Internet access. Such terminals include: PDAs, MIDs, and UMPCdevices, such as the iPad.

(3) Portable entertainment devices, which can display and playmultimedia content. Such devices include: audio/video players (such asiPod), handheld game consoles, e-books, and smart toys and portable carnavigation devices.

(4) Server, a device that provide computing services, consists of aprocessor, a hard disk, a memory, a system bus, etc. The server issimilar to a general computer architecture, but because of the need toprovide highly reliable services, processing power and stability Highreliability in terms of reliability, security, scalability, andmanageability.

(5) Other electronic devices with data interaction capabilities.

A person skilled in the art may understand that all or a part of theprocess of implementing the above method embodiments may be performed bya computer program to instruct related hardware, and the program may bestored in a computer readable storage medium. When the program isexecuted, the flow of embodiments of the methods as described above maybe included. The storage medium may be a magnetic disk, an optical disk,a read-only memory (ROM), or a random access memory (RAM).

The above description is merely specific embodiments of the presentdisclosure, the scope of the present disclosure is not limited thereto.Various changes and modifications of the present disclosure may be madewithout departing from the spirit and scope of the present disclosureshould be included in the scope of the present disclosure. Therefore,the scope of the disclosure should be determined by the scope of theclaims.

What is claimed is:
 1. A method for scanning cache of an applicationinstalled on an electronic device that comprises a processor and amemory, the method comprising: acquiring, by the processor, a list ofapplications to be scanned by invoking a system interface installed onthe electronic device; querying, by the processor and in a databasestored in the memory, a historical scanning record of each applicationin the list of applications to be scanned; determining, by theprocessor, a scanning priority of each application and whether theapplication needs to be scanned according to the historical scanningrecord of each application; scanning, by the processor, applicationsthat need to be scanned in the list of applications to be scanned in adescending order of the scanning priorities, so as to acquire cachesizes of respective applications that need to be scanned; and scanning,by the processor, applications that need not to be scanned in the listof applications to be scanned in a descending order of the scanningpriorities, so as to acquire cache sizes of respective applications thatneed not to be scanned, and finishing the scanning until a presetscanning duration is reached or a preset scanning ending condition issatisfied, wherein the historical scanning record comprises a cache sizeand a time for a previous scanning and a number of successively skippedtimes.
 2. The method according to claim 1, wherein determining thescanning priority of each application and whether the application needsto be scanned according to the historical scanning record of eachapplication comprises: determining that the application without thehistorical scanning record is to be preferentially scanned and needs tobe scanned; acquiring a first set of applications each with the cachesize for the previous scanning greater than a preset cache size, inwhich the applications each with the cache size for the previousscanning greater than the preset cache size need to be scanned and areto be scanned in a descending order of the cache sizes, and the scanningpriorities of applications with the same cache size for the previousscanning in the first set of applications are the same; acquiring asecond set of applications each with the number of successively skippedtimes greater than a preset number, in which the applications each withthe number of successively skipped times greater than the preset numberneed to be scanned and are to be scanned in a descending order of thenumbers of successively skipped times, and the scanning priorities ofapplications with the same number of successively skipped times in thesecond set of applications are the same; acquiring a third set ofapplications each with a time difference between a present time and thetime for the previous scanning greater than a preset time interval, inwhich the applications each with the time difference greater than thepreset time interval need to be scanned and are to be scanned in adescending order of the time differences, and the scanning priorities ofapplications with the same time difference in the third set ofapplications are the same; acquiring a fourth set of applications eachwith the cache size for the previous scanning smaller than or equal tothe preset cache size, in which the applications each with the cachesize for the previous scanning smaller than or equal to the preset cachesize need not to be scanned and are to be scanned in a descending orderof the cache sizes if the applications in the fourth set of applicationsare to be scanned, and the scanning priorities of applications with thesame cache size for the previous scanning in the fourth set ofapplications are the same; acquiring a fifth set of applications eachwith the number of successively skipped times smaller than or equal tothe preset number, in which the applications each with the number ofsuccessively skipped times smaller than or equal to the preset numberneed not to be scanned and are to be scanned in a descending order ofthe numbers of successively skipped times if the applications in thefifth set of applications are to be scanned, and the scanning prioritiesof applications with the same number of successively skipped times inthe fifth set of applications are the same; and determining that thescanning priorities of a sixth set of applications in the list ofapplications to be scanned and beyond the first to fifth sets ofapplications are the same and the sixth set of applications need not tobe scanned.
 3. The method according to claim 2, wherein afterdetermining the scanning priority of each application and whether theapplication needs to be scanned according to the historical scanningrecord of each application, the method further comprises: sorting thelist of applications to be scanned in a descending order of the scanningpriorities.
 4. The method according to claim 2, further comprising:updating the cache size and the time for the previous scanning and thenumber of successively skipped times of each application according to ascanning result after the scanning of respective application finishes.5. The method according to claim 1, wherein querying the historicalscanning record of each application in the list of applications to bescanned comprises: querying the historical scanning record correspondingto a package name of each application according to the package name ofeach application.
 6. An electronic device, comprising: a housing, aprocessor, a memory, a circuit board, a power supply circuit, wherein,the circuit board is located in a space enclosed by the housing; theprocessor and the memory are positioned on the circuit board; the powersupply circuit is configured to provide power for respective circuits orcomponents of the electronic device; the memory is configured to storeexecutable program codes; and the processor is configured to run aprogram corresponding to the executable program codes by reading theexecutable program codes stored in the memory, to perform the method forscanning cache of an application installed on the electronic device, themethod comprising: acquiring, by the processor, a list of applicationsto be scanned by invoking a system interface installed on the electronicdevice; querying, by the processor and in a database stored in thememory, a historical scanning record of each application in the list ofapplications to be scanned; determining, by the processor, a scanningpriority of each application and whether the application needs to bescanned according to the historical scanning record of each application;scanning, by the processor, applications that need to be scanned in thelist of applications to be scanned in a descending order of the scanningpriorities, so as to acquire cache sizes of respective applications thatneed to be scanned; and scanning, by the processor, applications thatneed not to be scanned in the list of applications to be scanned in adescending order of the scanning priorities, so as to acquire cachesizes of respective applications that need not to be scanned, andfinishing the scanning until a preset scanning duration is reached or apreset scanning ending condition is satisfied, wherein the historicalscanning record comprises a cache size and a time for a previousscanning and a number of successively skipped times.
 7. The electronicdevice according to claim 6, wherein the processor is further configuredto: determine that the application without the historical scanningrecord is to be preferentially scanned and needs to be scanned; acquirea first set of applications each with the cache size for the previousscanning greater than a preset cache size, in which the applicationseach with the cache size for the previous scanning greater than thepreset cache size need to be scanned and are to be scanned in adescending order of the cache sizes, and the scanning priorities ofapplications with the same cache size for the previous scanning in thefirst set of applications are the same; acquire a second set ofapplications each with the number of successively skipped times greaterthan a preset number, in which the applications each with the number ofsuccessively skipped times greater than the preset number need to bescanned and are to be scanned in a descending order of the numbers ofsuccessively skipped times, and the scanning priorities of applicationswith the same number of successively skipped times in the second set ofapplications are the same; acquire a third set of applications each witha time difference between a present time and the time for the previousscanning greater than a preset time interval, in which the applicationseach with the time difference greater than the preset time interval needto be scanned and are to be scanned in a descending order of the timedifferences, and the scanning priorities of applications with the sametime difference in the third set of applications are the same; acquire afourth set of applications each with the cache size for the previousscanning smaller than or equal to the preset cache size, in which theapplications each with a cache size for the previous scanning smallerthan or equal to the preset cache size need not to be scanned and are tobe scanned in a descending order of the cache size if the applicationsin the fourth set of applications are to be scanned, and the scanningpriorities of applications with the same cache size for the previousscanning in the fourth set of applications are the same; acquire a fifthset of applications each with the number of successively skipped timessmaller than or equal to the preset number, in which the applicationseach with a great number of successively skipped times smaller than orequal to the preset number need not to be scanned and are to be scannedin a descending order of the numbers of successively skipped times ifthe applications in the fifth set of applications are to be scanned, andthe scanning priorities of applications with the same number ofsuccessively skipped times in the fifth set of applications are thesame; determine that the scanning priorities of a sixth set ofapplications in the list of applications to be scanned and beyond thefirst to fifth sets of applications are the same and the sixth set ofapplications need not to be scanned.
 8. The electronic device accordingto claim 7, wherein the processor is further configured to: sort thelist of applications to be scanned in a descending order of the scanningpriorities.
 9. The electronic device according to claim 7, whereinprocessor is further configured to: update the cache size and the timefor the previous scanning and the number of successively skipped timesof each application according to a scanning result after the scanning ofrespective application ends.
 10. The electronic device according toclaim 6, wherein processor is further configured to: query thehistorical scanning record corresponding to a package name of eachapplication according to the package name of each application.
 11. Anon-transitory computer-readable storage medium having instructionsstored thereon, wherein when the instructions are executed by aprocessor, the processor is caused to perform the method for scanningcache of an application installed on an electronic device, the methodcomprising: acquiring, by the processor, a list of applications to bescanned; querying, by the processor and in a database stored in theelectronic device, a historical scanning record of each application inthe list of applications to be scanned; determining, by the processor, ascanning priority of each application and whether the application needsto be scanned according to the historical scanning record of eachapplication; scanning, by the processor, applications that need to bescanned in the list of applications to be scanned in a descending orderof the scanning priorities, so as to acquire cache sizes of respectiveapplications that need to be scanned; and scanning, by the processor,applications that need not to be scanned in the list of applications tobe scanned in a descending order of the scanning priorities, so as toacquire cache sizes of respective applications that need not to bescanned, and finishing the scanning until a preset scanning duration isreached or a preset scanning ending condition is satisfied, wherein thehistorical scanning record comprises a cache size and a time for aprevious scanning and a number of successively skipped times.